<template>
	<view>
		<view v-if="id != ''" style="width:100%">
			<ad :unit-id="id" :ad-type="ad_type" ad-theme="white" grid-count="5"></ad>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	
	export default {
		name: "myAd",
		props: {
			type: {
				type: String,
				default: ''
			}
		},
		data(){
			return {
				list:[],
				id:'',
				ad_type:'banner'
			}
		},
		mounted() {
			this.getAd();
		},
		methods:{
			async getAd(){
				let res = await this.$myHttp.post({
					url:this.$myHttp.urlMap.getAd,
					data:{},
					needLogin:false,
				})
				if(res.code == 1){
					this.list = res.data
					this.id = this.list[this.type-1].advert
					this.ad_type = this.list[this.type-1].advert_type
				}
			},
		}
	}
</script>

<style>
</style>
